<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Layout
{
	private $CI;
	private $var = array();

	
	public function __construct()
	{
		$this->CI = get_instance();
		$this->vars['output'] = '';
		$this->vars['title'] = 'TGL';
		$this->vars['css'] = array();
	}
	
	public function setTitle( String $title )
	{
		if( is_string( $title ) AND !empty( $title ) )
		{
			$this->vars['title'] = $title;
			return true;
		}
		return false;
	}
	
	public function addCss( String $css_filename )
	{
		if( is_string( $css_filename ) AND !empty( $css_filename ) )
		{
			$this->vars['css'][] = $css_filename;
			return true;
		}
		return false;
	}
	
	public function view( $name, $data = array() )
	{
		$this->vars['output'] .= $this->CI->load->view( $name, $data, true );
		if( isset( $data['errors'] ) )
			$this->vars['errors'] = $data['errors'];
		$this->CI->load->view( '../themes/default', $this->vars );
	}
	
	public function views( $name, $data = array() )
	{
		$this->vars['output'] .= $this->CI->load->view( $name, $data, true );
		return $this;
	}
}

/* End of file layout.php */
/* Location: ./application/libraries/layout.php */ ?>